<template>
  <view class="index">
    <!-- 我发布的订单 -->
    <tab-tatus  @getData="getData" ></tab-tatus>

    <!-- 隔断 -->
    <view class="h80">&nbsp;</view>
    <view class="h40">&nbsp;</view>

    <!-- 订单信息 -->
    <OrderList :order_list="order_list"></OrderList>
    <Tabbar></Tabbar>
  </view>
</template>

<script>
import "./libo.less";
import OrderList from "@/components/orderList/orderList.vue";
import Tabbar from "@/components/TabBar.vue";
import LiboItem from "@/components/liboItem";
import tabTatus from "./components/tab-status/tab-tatus.vue";
import { getOrderList } from "/src/service/apis/order";
import { AtTabs, AtTabsPane } from "taro-ui-vue";
import { reactive, ref, onMounted, toRefs } from "vue";
export default {
  name: "libo",
  setup() {
    const state = reactive({
      params: {
        mode: 2,  //    2 接单  1 发布
        status: 0, //订单状态
      },
      order_list: [],
    });

    //获取数据
    async function getData(params) {
      if(params){
        state.params = params
      }
      
      let { data } = await getOrderList(state.params);
      // data = data.data;
      state.order_list = data.data;
      console.log(data.data, "---data.data");
    }



    onMounted(() => {
      state.order_list = []
      getData();
    });

    return {
      ...toRefs(state),

      getData,
    };
  },
  components: {
    Tabbar,
    tabTatus,
    OrderList,
  },
};
</script>